package org.my_spring_mybatis;

import org.junit.Test;
import org.my_spring_mybatis.domain.Student;
import org.my_spring_mybatis.domain.dao.StudentDao;
import org.my_spring_mybatis.domain.service.StudentService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * @author lihai
 * @Description
 * @create 2022/1/25 -23:53
 */
public class Mytest {
    @Test
    public void testStudent(){
        String config = "applicationContext.xml";
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(config);
//        String[] names = applicationContext.getBeanDefinitionNames();
//        for(String name : names){
//            System.out.println(applicationContext.getBean(name).getClass().getName());
//        }
        StudentDao studentDao = ctx.getBean("studentDao", StudentDao.class);
//        System.out.println(studentDao);
        for (Student student : studentDao.selectStudent()) {
            System.out.println(student);

        }


    }
}
